// Bristleback plugin - Copyright (c) 2010 bristleback.googlecode.com
// ---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
// This library is distributed in the hope that it will be useful,
// but without any warranty; without even the implied warranty of merchantability
// or fitness for a particular purpose.
// You should have received a copy of the GNU Lesser General Public License along
// with this program; if not, see <http://www.gnu.org/licenses/lgpl.html>.
// ---------------------------------------------------------------------------
package pl.bristleback.server.bristle.config;

import org.apache.log4j.Logger;

/**
 * Base Bristleback JWebsocket Plugin constants.
 * Values of those constants are names of plugin settings, plugin token namespace and maybe more in future.
 * <p/>
 * Created on: 2010-10-04 17:21:29 <br/>
 *
 * @author Wojciech Niemiec
 */
public final class BristleConstants {
  private static Logger log = Logger.getLogger(BristleConstants.class.getName());

  private BristleConstants() {
    throw new UnsupportedOperationException();
  }

  /**
   * Bristle plugin namespace, used to indicate that token should be processed by Bristle plugin.
   */
  public static final String BRISTLE_PLUGIN_NAMESPACE = "bristlePlugin";

  /**
   * Element of token used for dispatching incoming messages. Every token has to contain this element.
   */
  public static final String ACTION_NAME_TOKEN_VARIABLE = "type"; //todo-wojtek search for constant in jwebsocket library

  /**
   * Configuration element, prefix of message sender name setting.
   * Used in default implementation of {@link MessageContainerResolver} interface.
   * There can be multiple message senders used in the same time. Senders can be obtained in two ways,
   * by creating new instance of sender (message sender class name required)
   * or by retrieving Spring bean (message sender Spring bean reference required).
   * Format of message senders setting key is: bristle.message.sender[index].
   * Format of the value: 'senderName: senderClassType' or 'senderName: senderSpringBeanName'.
   */
  public static final String MESSAGE_SENDER_SETTING_KEY_PREFIX = "bristle.message.sender";

  /**
   * Configuration element name for action package location definition.
   */
  public static final String ACTION_PACKAGE_SETTING_NAME = "actionPackage";

  /**
   * Name of connector rights set token element created when connector is connecting.
   */
  public static final String CONNECTOR_RIGHTS_SET_VARIABLE_NAME = "bristleCRS";

  /**
   * Configuration element, prefix of server state listener name setting.
   * Used in {@link pl.bristleback.server.bristle.states.ServerStateInspector} class.
   * There can be multiple server state listeners used in the same time. Listeners can be obtained in two ways,
   * by creating new instance of listener (then class name is required)
   * or by retrieving Spring bean (Spring bean reference required).
   * Format of message server state listener setting key is: bristle.state.listener[index].
   * Format of the value: 'listenerName: listenerClassType' or 'listenerName: listenerSpringBeanName'.
   */
  public static final String SERVER_STATE_LISTENER_SETTING_KEY_PREFIX = "bristle.state.listener";

  /**
   * Configuration element, prefix of exception handler name setting.
   * Used in {@link pl.bristleback.server.bristle.config.ExceptionHandlersInitializer} class.
   * There can be multiple exception handlers used in the same time. Handlers can be obtained in two ways,
   * by creating new instance of exception handler (then class name is required)
   * or by retrieving Spring bean (Spring bean reference required).
   * Format of exception handler setting key is: bristle.exception.handler[index].
   * Format of the value: 'handlerName: handlerClassType' or 'handlerName: handlerSpringBeanName'.
   */
  public static final String EXCEPTION_HANDLER_SETTING_KEY_PREFIX = "bristle.exception.handler";

  /**
   * This settings can be set as one of context parameter in 'web.xml' in web application.
   * It is a path of the jwebsocket configuration file.
   * If not set, configuration file will be searched in default locations, depending on jWebsocket library version.
   */
  public static final String CONFIG_FILE_LOCATION_CONTEXT_VARIABLE_NAME = "bristlePluginConfigurationFilename";

  /**
   * This settings can be set as one of context parameter in 'web.xml' in web application.
   * If set to 'true', Spring Framework integration will be enabled.
   */
  public static final String SPRING_INTEGRATION_CONTEXT_VARIABLE_NAME = "bristlePluginEnableSpring";
}
